<li id="usersCreatfilter" style="display: list-item;position: relative;">
    <label>制单人:</label>
    <span id="usersCreat">
        <span class="ui-combo-wrap" style="width: 255px;">
            <input type="text" class="input-txt" autocomplete="off" readonly="readonly" style="cursor: default; width: 225px !important;" id="add_user">
            <span class="trigger" id="usersCreatTrigger"></span>
        </span>
    </span>


    <div class="ui-droplist-wrap" id="usersCreatBox" style="position: absolute; z-index: 1000; width: 255px; display: none;left: 80px;top: calc(100% + 2px); ">
        <div class="droplist" style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
            <div class="list-item selected" data-value="0" title="空">空</div>
            {volist name="add_user" id="vo"}
                <div class="list-item" data-value="{$vo.id}" title="{$vo.username}">{$vo.username}</div>
            {/volist}
        </div>
    </div>
</li>

<input type="hidden" id="usersCreatId" value="">




<script type="text/javascript">
	$(document).ready(function () {

		// 点击选择制单人
		$("#usersCreat").click(function(){
			$("#usersCreatBox").toggle();
		});
		// 制单人赋值
		$("#usersCreatBox .list-item").click(function(){
			$("#add_user").val($(this).attr("title"));
			$("#usersCreatId").val($(this).attr("data-value"));
			$(this).addClass("selected").siblings().removeClass("selected");
			$("#usersCreatBox").hide();
		});
	});

	//选择制单人-选择框外点击则隐藏
    $(document).mouseup(function (e) {
      if(e.target.id!="add_user" && e.target.id!="usersCreatTrigger"){
            var con = $("#usersCreatBox");   // 设置目标区域
            if (!con.is(e.target) && con.has(e.target).length === 0) {
              $("#usersCreatBox").hide();
            }
        } 
    });
</script>



